package com.sig.formes;

import java.util.List;

import android.opengl.Matrix;

public abstract class Forme implements IForme{

	protected boolean cree = false;

	protected volatile float angle = 0.0f;
	protected volatile float[] color = blanc;

	private final static float[] mRotationMatrix = new float[16];

	public static float bleu[] = { 0.67f, 0.8f, 0.8f, 0.5f };
	public static float bleuclair[] = { 0.67f, 0.8f, 1.0f, 0.5f };
	public static float blanc[] = { 1f, 1f, 1f, 0.5f };
	public static float jaune[] = { 1f, 0.9f, 0.7f, 0.5f };
	public static float rouge[] = { 1f, 0f, 0f, 0.5f };
	public static float violet[] = { 1f, 0f, 1f, 0.5f };
	public static float rose[] = { 1f, 0.8f, 0.8f, 0.5f };
	public static float gris[] = { 0.89f, 0.89f, 0.89f, 0.5f };
	public static float gris_claire[] = { 0.8f, 0.8f, 0.8f, 0.5f };
	public static float gris_fonce[] = { 0.7f, 0.7f, 0.7f, 0.5f };
	public static float vert[] = { 207/255f, 236/255f, 168/255f, 0.5f };
	public static float vert_fonce[] = { 0.6f, 0.71f, 0.43f, 0.5f };
	public static float noir[] = { 0.0f, 0.0f, 0.0f, 0.5f };
	public static float marron[] = { 1.0f, 0.8f, 0.5f, 0.5f };
	public static float marron_clair[] = { 1.0f, 0.8f, 0.8f, 0.5f };
	public static float turquoise[] = { 0.7f, 0.7f, 1.0f, 0.5f };
	public static float rose_claire[] = { 1f, 0.7f, 0.7f, 0.5f };
	public static float defaut[] = { 0.9f, 0.9f, 0.9f, 1.0f };


	public void recreer(){
		this.cree = false;
	}

	public float[] getColor(){
		return this.color;
	}
	public void setColor(float[] color){
		this.color = color;
	}

	public float getAngle(){
		return this.angle;
	}
	public void setAngle(float angle){
		this.angle = angle;
	}
	public void addAngle(float angle){
		this.angle += angle;
	}

	public void draw(float[] mMVPMatrix){
		Matrix.setIdentityM(mRotationMatrix, 0);

		if(getAngle() != 0){
			Matrix.setRotateM(mRotationMatrix, 0, getAngle(), 0, 0, -1.0f);
			Matrix.multiplyMM(mMVPMatrix, 0, mRotationMatrix, 0, mMVPMatrix, 0);
		}
	}

	public abstract List<Triangle> getTriangles();

}
